package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.system.domain.SysTradingrecord;
import com.ruoyi.system.mapper.SysTradingrecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TbDisburesMapper;
import com.ruoyi.system.domain.TbDisbures;
import com.ruoyi.system.service.ITbDisburesService;

import javax.annotation.Resource;

/**
 * 【请填写功能名称】Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-03-19
 */
@Service
public class TbDisburesServiceImpl implements ITbDisburesService 
{
    @Autowired
    private TbDisburesMapper tbDisburesMapper;

    @Resource
    private SysTradingrecordMapper sysTradingrecordMapper;

    /**
     * 查询【请填写功能名称】
     * 
     * @param disburseId 【请填写功能名称】主键
     * @return 【请填写功能名称】
     */
    @Override
    public TbDisbures selectTbDisburesByDisburseId(Long disburseId)
    {
        return tbDisburesMapper.selectTbDisburesByDisburseId(disburseId);
    }

    /**
     * 查询【请填写功能名称】列表
     * 
     * @param tbDisbures 【请填写功能名称】
     * @return 【请填写功能名称】
     */
    @Override
    public List<TbDisbures> selectTbDisburesList(TbDisbures tbDisbures)
    {
        return tbDisburesMapper.selectTbDisburesList(tbDisbures);
    }

    /**
     * 新增【请填写功能名称】
     * 
     * @param tbDisbures 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int insertTbDisbures(TbDisbures tbDisbures)
    {
        tbDisburesMapper.insertTbDisbures(tbDisbures);
        SysTradingrecord sysTradingrecord=new SysTradingrecord();
        sysTradingrecord.setCreatetime(tbDisbures.getDisburseDate());
        sysTradingrecord.setDitType("支出");
        sysTradingrecord.setDitId(tbDisbures.getDisburseId());
        int tradingrecord=sysTradingrecordMapper.insertSysTradingrecord(sysTradingrecord);
        return tradingrecord;
    }

    /**
     * 修改【请填写功能名称】
     * 
     * @param tbDisbures 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int updateTbDisbures(TbDisbures tbDisbures)
    {
        return tbDisburesMapper.updateTbDisbures(tbDisbures);
    }

    /**
     * 批量删除【请填写功能名称】
     * 
     * @param disburseIds 需要删除的【请填写功能名称】主键
     * @return 结果
     */
    @Override
    public int deleteTbDisburesByDisburseIds(Long[] disburseIds)
    {
        return tbDisburesMapper.deleteTbDisburesByDisburseIds(disburseIds);
    }

    /**
     * 删除【请填写功能名称】信息
     * 
     * @param disburseId 【请填写功能名称】主键
     * @return 结果
     */
    @Override
    public int deleteTbDisburesByDisburseId(Long disburseId)
    {
        return tbDisburesMapper.deleteTbDisburesByDisburseId(disburseId);
    }
}
